package com.bywlkjs.bygo.wechat.applet.spring.boot.entity;

import com.alibaba.fastjson.JSON;
import com.bywlkjs.common.util.WebSentUtil;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

public class AuthGetPaidUnionIdEntity implements Serializable {

    public static String REQUEST_URL="https://api.weixin.qq.com/wxa/getpaidunionid";

    @Data
    @Accessors(chain = true)
    public static class Param{
        private String access_token;
        private String openid;
        private String transaction_id;
        private String mchId;
        private String out_trade_no;
    }

    @Data
    @Accessors(chain = true)
    public static class Result{
        private String unionid;
        private String errcode;
        private String errmsg;

        private static Result createInstance(Param param){
            String result= WebSentUtil.sendGet(AuthGetPaidUnionIdEntity.REQUEST_URL,param);
            return JSON.parseObject(result, Result.class);
        }
    }



}
